package org.xiaojinlong.exam;

import java.util.Scanner;

/**
 * @author Jin Long
 * 2015/9/21
 */
public class LinuxStableVersion {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int total = scanner.nextInt();
            scanner.nextLine();
            int major = 0, minor = 0, patchlevel = 0;
            for (int i = 0; i < total; i++) {
                String str = scanner.nextLine();
                String[] versions = str.split("\\.");

                int majorCurrent, minorCurrent, patchlevelCurrent;
                minorCurrent = Integer.valueOf(versions[1]);
                if (minorCurrent % 2 != 0)
                    continue;
                majorCurrent = Integer.valueOf(versions[0]);

                if (major < majorCurrent) {
                    major = majorCurrent;
                    minor = minorCurrent;
                    patchlevel = 0;
                } else if (major == majorCurrent && minor < minorCurrent) {
                    minor = minorCurrent;
                    patchlevel = 0;
                }

                if (versions.length > 2) {
                    patchlevelCurrent = Integer.valueOf(versions[2]);
                    if (major == majorCurrent && minor == minorCurrent && patchlevel < patchlevelCurrent)
                        patchlevel = patchlevelCurrent;
                }
            }
            if (major == 0) {
                System.out.println("no stable available");
            } else if (patchlevel == 0)
                System.out.println(major + "." + minor);
            else
                System.out.println(major + "." + minor + "." + patchlevel);
        }
    }
}
